package com.jj.spb.spring_boot_mybatis.factory;

import com.alibaba.fastjson.JSON;
import com.jj.spb.spring_boot_mybatis.resultEntity.Result;

public class ResultFactory {
    public static final int ERROR_OK = 200;
    public static final int ERROR_PARAM = 401;
    public static final int ERROR_METHOD = 500;
    public static final int ERROR_FAILD = 1001;

    public static String buildResultBody(boolean isSuccess,Object content,int errorCode,String message){
        Result result = new Result();
        result.setSuccess(isSuccess);
        result.setContent(content);
        result.setErrorCord(errorCode);
        result.setErrorMessage(message);
        return JSON.toJSONString(result);
    }
}
